cmake_minimum_required(VERSION 3.22.1)

project("ffmpeg")

#拼接ffmpeg目录
set(PREFIX "${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}")
set(HeaderPATH "${CMAKE_SOURCE_DIR}")

#包含ffmpeg头文件目录
include_directories(${HeaderPATH}/include)

#添加链接目录
link_directories(${PREFIX})
#搜索ffmpeg目录下的所有.so文件
file(GLOB SO_FILES "${PREFIX}/*.so")
#获取目录下所有库名
foreach (SO_FILE IN LISTS SO_FILES)
    get_filename_component(LIB_NAME ${SO_FILE} NAME)
    list(APPEND FFMPEG_LIBRARIES "${LIB_NAME}")
endforeach ()

add_library(
        ${CMAKE_PROJECT_NAME}
        SHARED
        ffmpeg.cpp
)

target_link_libraries(
        ${CMAKE_PROJECT_NAME}
        ${FFMPEG_LIBRARIES}
        android
        log
)
